package com.atues.exceptionExample;

public class Main {
    public static void main(String[] args) {
        System.out.println(f(2));

        try {
            System.out.println("Try to do something");
            throw new RuntimeException("RuntimeException");
        } catch (Exception e) {
            System.out.println("Catch Exception -> " + e.getMessage());
        } finally {
            System.out.println("Finally");
        }
    }

    public static int f(int value) {
        try {
            return value / 0;
        }catch (Exception e) {
            System.out.println("Catch Exception -> " + e.getMessage());
            return 1;
        }finally {
            if (value == 2) {
                return 0;
            }
        }
    }
}
